package com.pattern.design.designpattern.databind;

import androidx.databinding.BaseObservable;
import androidx.databinding.Bindable;

import com.pattern.design.designpattern.BR;


public class UserBean extends BaseObservable {
    private String id;
    private String name;
    private String blog;

    @Bindable //自动刷新
    public String getId() {
        return id;
    }


    //BR是编译阶段生成的一个类，功能与R.java类似
    //用@Bindable标记过getter方法会在BR中生成一个entry
    public void setId(String id) {
        this.id = id;
//        notifyPropertyChanged(BR.id);//自动刷新
    }

    @Bindable
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
//        notifyPropertyChanged(BR.name);
    }

    @Bindable
    public String getBlog() {
        return blog;
    }

    public void setBlog(String blog) {
        this.blog = blog;
//        notifyPropertyChanged(BR.blog);
    }


}
